#ifndef GLOBALPARAMETER_H
#define GLOBALPARAMETER_H

#include <QString>

#define ARRIVING_TIME_NUMBER 3

// struct used to show out the arrivingTime of a specified station
typedef struct
{
    QString busName; // the name of the bus
    QString directionFrom; // which direction the user will take? this indicates the from station name
    QString directionTo; // which direction the user will take? this indicates the end station name
    int     arrivingTimeForStart; // arriving time of the bus that reaches the start position. It will be just after the user's specified time
    int     arrivingTimeForEnd;// arriving time of the bus that reaches the end postion.
    int     howManyStationsInterval; // pass how many intervals?

    QString customerWantBeginStation;
    QString customerWantEndStation;
}BUS_INFO_FOR_OUT;

// struct used to show out all the necessary stations
typedef struct
{
    QString stationName;
    int arrivingTime; //arriving time from start to end, that is just after the user's specified time
    int arrivingTimeAnti; // arriving time from end to start, that is just after the user's specified time
}STATION_INFO_FOR_OUT;

// a struct that is used in the station-based hash table, which will help to find out
// the appropreate bus time and bus number for the specifed rountin.
struct BUS_INFO_STATION_BASED
{
    // a bus have two directions, one is from begin station to the last one, while another is vice
    QString BeginPosition; // the start position of the bus
    QString EndPosition; // the end position of the bus

    QString busName; // the name of the bus
    int interval; // the interval that this bus will arrive the next time

    int seqStartToEnd; //this station is the (idStartToEnd)th one from the start to the end
    int firstStartTimeStartToEnd; //mins of the day, the first time when the bus passes this station
    int lastStartTimeStartToEnd; // mins of the day, the last time when the bus passes this station

    int seqEndToStart; //this station is the (idStartToEnd)th one from the end to the start
    int firstStartTimeEndToStart; //mins of the day, the first time when the bus passes this station
    int lastStartTimeEndToStart; // mins of the day, the last time when the bus passes this station

    BUS_INFO_STATION_BASED(QString beginStation, QString endStation,\
                      QString busName, int interval,\
                      int seqStartToEnd, int firstStartTimeStartToEnd, int lastStartTimeStartToEnd,\
                      int seqEndToStart, int firstStartTimeEndToStart, int lastStartTimeEndToStart)
    {
        this->BeginPosition = beginStation;
        this->busName = busName;
        this->EndPosition = endStation;
        this->firstStartTimeEndToStart = firstStartTimeEndToStart;
        this->firstStartTimeStartToEnd = firstStartTimeStartToEnd;
        this->seqEndToStart = seqEndToStart;
        this->seqStartToEnd = seqStartToEnd;
        this->interval = interval;
        this->lastStartTimeEndToStart = lastStartTimeEndToStart;
        this->lastStartTimeStartToEnd = lastStartTimeStartToEnd;
    }
};

// a struct indicating bus name as well as station time, which will help to find all the
// station information according to the specified expecting time
struct BUS_INFO_NAME_BASED
{
    QString busName;
    QString startStation;
    QString endStation;
    int interval;

    QString stationName;

    //start to end
    int firstTimeStart2End;
    int lastTimeStart2End;

    // end to start
    int firstTimeEnd2Start;
    int lastTimeEnd2Start;

    BUS_INFO_NAME_BASED(){}

    BUS_INFO_NAME_BASED(QString busName, QString startStation, QString endStation, \
                        QString stationName, int interval,\
                        int firstTimeS2E, int lastTimeS2E,\
                        int firstTimeE2S, int lastTimeE2S)
    {
        this->busName = busName;
        this->startStation = startStation;
        this->endStation = endStation;
        this->interval = interval;
        this->stationName = stationName;
        this->firstTimeEnd2Start = firstTimeE2S;
        this->lastTimeEnd2Start = lastTimeE2S;
        this->firstTimeStart2End = firstTimeS2E;
        this->lastTimeStart2End = lastTimeS2E;
    }
};

#endif // GLOBALPARAMETER_H
